package com.example.demo;

import com.example.demo.mapper.PmWorkCardMapper;
import org.apache.ibatis.jdbc.SQL;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.sql.Timestamp;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;

@Component
public class Test {

    @Autowired
    private PmWorkCardMapper pmWorkCardMapper;

    @Value("${test}")
    private Object enabled;

    @PostConstruct
    public void init(){
        List<Map<String,Object>> ob = pmWorkCardMapper.ob("select * from test");
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
        String format = ((Timestamp) ob.get(0).get("start_time")).toLocalDateTime().format(dateTimeFormatter);
        System.out.println();
    }

}
